'use strict';

const Controller = require('egg').Controller;

class ScoreController extends Controller {
  async search() {
    const { ctx } = this
        let { data } = ctx.request.body;
        console.log(data)
    // 查询数据库，获取学生姓名和科目对应的成绩
    const score = await ctx.service.score.searchScore(data.username, data.exam_id);
    if(score === null){
      ctx.apiFail(data="", '您所查询的成绩不存在，请正确选择查询条件', 400)
    }
    ctx.apiSuccess(score);
  }

}

module.exports = ScoreController;
